﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:asp="remove">
  <xsl:output method="xml" indent="yes" encoding="utf-8" omit-xml-declaration="yes"/>
  <xsl:template match="/">
    <table>
      <xsl:for-each select="//question">
        <tr>
          <td valign="top">
            <xsl:value-of select="@name" />
            <xsl:if test="@required = 'yes'">
              <asp:RequiredFieldValidator ErrorMessage="Required 
                Field" runat="server" ControlToValidate="{@name}" />
            </xsl:if>
          </td>
          <td>
            <xsl:if test="@type='text'">
              <asp:TextBox id="{@name}" runat="server" />
            </xsl:if>
            <xsl:if test="@type='checkbox'">
              <asp:CheckBox ID="{@name}" runat="server" />
            </xsl:if>
            <xsl:if test="@type='radio'">
              <asp:CheckBoxList id="{@name}" runat="server">
                <xsl:for-each select="choice">
                  <asp:ListItem Value="{@value}">
                    <xsl:value-of select="@value"/>
                  </asp:ListItem>
                </xsl:for-each>
              </asp:CheckBoxList>
            </xsl:if>
          </td>
        </tr>
      </xsl:for-each>
    </table>
    <asp:button id="submit" runat="server" Text="Submit" />
  </xsl:template>
</xsl:stylesheet>
